package com.oa.common.enums.apps;

import com.oa.common.interfaces.CodeStatus;

/**
 * @name 组件类型的枚举
 * @author Yang
 * @date 2018-07-12
 * @version 1.0.1
 */
public enum FromFileType implements CodeStatus {

    /** 输入框 **/
    INPUT(0,"输入框","text"),

    /** 输入区 **/
    TEXTAREA(1,"输入区","textarea"),

    /** 单选框 **/
    RADIO(2,"单选框","radios"),

    /** 多选框 **/
    CHECKBOX(3,"多选框","checkboxs"),

    /** 下拉框 **/
    SELECT(4,"下拉框","select"),

    /** 手写板 **/
    CANVAS(5,"手写板","canvas"),

    ;
    /** 编号 **/
    private int code;

    /** 说明 **/
    private String message;

    /** 事件 **/
    private String handler;

    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public void setMessage(String message) {
        this.message= message;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public void setCode(int code) {
        this.code= code;
    }

    FromFileType(int code,String message,String handler){
        this.code= code;
        this.message= message;
        this.handler= handler;
    }

    public String getHandler() {
        return handler;
    }

    public void setHandler(String handler) {
        this.handler = handler;
    }

    public static String getMessage(int code){
        for (FromFileType type:FromFileType.values()){
            if (code== type.getCode()){
                return type.getMessage();
            }
        }
        return null;
    }
}
